<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet"  href="css/base.css"/>
		<script src="js/jquery.min.js"></script>
		<link href="主页demo/js/layui/css/layui.css" rel="stylesheet"/>
		<script src="主页demo/js/layui/layui.js"></script>
		<link rel<link rel="stylesheet"  href="css/common.css"/>
		<style>
			.content{
				width: 300px;
				height: 300px;
				border: 1px solid black;
				overflow-x: overlay;
				margin:calc(50vh - 150px)  auto;
			}
			.item{
				
				width: 100%;
				border: 1px solid red;
				
			}
			.item1{
				position: relative;
				top: 0;
			}
		</style>
	</head>
	<body>
		
		
		<div id="content" class="content">
		<div id="" class="item1">
			<div id="" class=" item">
				1好和酸辣黄瓜i代购爱好和购爱好和酸辣黄瓜i
			</div>
			<div id="" class="item">
				2好和酸辣黄瓜i代购爱好和酸辣黄瓜i代购爱好和酸辣黄瓜i
			</div>
			<div id="" class="item">
				3好和酸辣黄瓜i代购爱好和酸辣黄瓜i代购爱好和酸辣黄瓜i
				好和酸辣黄瓜i代购爱好和酸辣黄瓜i代购爱好和酸辣黄瓜i
			</div>
			<div id="" class="item">
				4好和酸辣黄瓜i代购爱好和酸辣黄瓜i代购爱好和酸辣黄瓜i				
			</div>
			<div id="" class="item">
				5好和酸辣黄瓜i代购爱好和酸辣黄瓜i代购爱好和酸辣黄瓜i
				好和酸辣黄瓜i代购爱好和酸辣黄瓜i代购爱好和酸辣黄瓜i
			</div>
			<div id="" class="item">
				6好和酸辣黄瓜i代购爱好和酸辣黄瓜i代购爱好和酸辣黄瓜i
				好和酸辣黄瓜i代购爱好和酸辣黄瓜i代购爱好和酸辣黄瓜i
			</div>
			<div id="" class="item">
				7好和酸辣黄瓜i代购爱好和酸辣黄瓜i代购爱好和酸辣黄瓜i
				
			</div>
			<div id="" class="item">
				8好和酸辣黄瓜i代购爱好和酸辣黄瓜i代购爱好和酸辣黄瓜i
				
			</div>
			<div id="" class="item">
				9好和酸辣黄瓜i代购爱好和酸辣黄瓜i代购爱好和酸辣黄瓜i
				
			</div>
		</div>
		</div>
		
		
		<script>
			$(function(){
				let timer=[2000,4000,3000,2000,4000,4000,2000,3000,3000];
				function xh(i){
					
					return new Promise((resolve,reject)=>{
						setTimeout(function(){
							$(".item").eq(i+1).css("color","red")
							$(".item").eq(i+1).siblings().css("color","")
							if(i>=1){
								let height=$(".item").eq(i-1).height() ;
								let scolltop=$(".content").scrollTop()+height+2
								console.log( $(".content").scrollTop())								
								 $(".content").scrollTop(scolltop)    
							}	
							resolve('true')
						},timer[i])
					})
					
				}
				 async function  x(timer){
					$(".item").eq(0).css("color","red")
					for(let i=0;i<timer.length;i++){
						let str= await xh(i)
						
					}
				}
				x(timer)
			})
		</script>
	</body>
</html>
